import {defineStore} from "pinia";

export const useCounterStore = defineStore("counter",{

  state:()=>{
    return {
      count:5,
      msg:"hello"
    }
  },

  actions:{
    increment(){
      this.count++;
    }
  }

})

export const usePersonStore = defineStore("person",{

  state:()=>{
    return {
      age:16,
      name:"王义鑫"
    }
  },

  getters:{
    doubleAge(state){
      console.log("state",state);
      console.log("this",this);      
      return state.age*state.age +this.incAge();
    }    
  },

  actions:{
    incAge(){
      return 3;
    }
  }


})